SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO


CREATE PROCEDURE dbo.[DnnProduct_AutomaticStuckOrderHandling_LastOrderStatusesCount]
	@WhereClause nvarchar(1000)
AS
BEGIN
	DECLARE @SQLString NVARCHAR(1000)

	
	SET @SQLString = N'
		SELECT count(LastOrderStatusesId)
		FROM DnnProduct_AutomaticStuckOrderHandling_LastOrderStatuses
		WHERE (1 = 1)'
	

	IF (LEN(@WhereClause) > 0)
	BEGIN
		SET @SQLString = @SQLString + @WhereClause
	END
	
	EXECUTE sp_executesql @SQLString
END
GO
